import instance from "./index.js";

export async function getBlogs(page = 1, limit = 10, categoryId = -1){
    return await instance.get("/api/blog", {
        params: {
            page,
            limit,
            categoryId
        }
    });
}

export async function getBlogTypes(){
    return await instance.get("/api/blogtype");
}

export async function getBlog(id){
    return await instance.get("/api/blog/" + id);
}

export async function addComment(commentInfo){
    return await instance.post("/api/comment", commentInfo);
}

export async function getComment(page = 1, limit = 10, blogId){
    return await instance.get("/api/comment", {
        params: {
            page,
            limit,
            blogId
        }
    });
}
